# pythonchallenge.com scripts
# challenge #5
# url: http://www.pythonchallenge.com/pc/def/peak.html


# load the pickle:

import pickle
fread = 'C:\\PYTHON_ROOT\\pythonchallenge\\banner.p'
fwrite = 'C:\\PYTHON_ROOT\\pythonchallenge\\ch5.txt'

# read banner.p
print 'read banner.p'
fr = open(fread, 'rb')
x = fr.read()
print x

# unpickle it
print 'unpickle banner.p'
pstring = pickle.loads(x)
print pstring

# ascii art?
output = ''
for s in pstring:
  output += '\n'
  for t in s:
    output += t[0] * t[1]
    
# print to file  
fw = open(fwrite, 'w')
fw.write(str(output))  
print output

    
    



  
